
public class Rule {
    Person person = new Person();
    Computer computer = new Computer();
    int a = person.getScore();
    int b = person.getScore();
    public int whoWin(String ppunch, String cpunch){
        if (ppunch.equals(cpunch)){
            return 0; //平局
        }else if (ppunch.equals("剪刀")){
            if (cpunch.equals("石头")){
                return 1; // 电脑赢
            }else {
                return 2; // 人赢
            }
        }else if (ppunch.equals("石头")){
            if (cpunch.equals("布")){
                return 1;
            }else {
                return 2;
            }
        }else if (ppunch.equals("布")){
            if (cpunch.equals("剪刀")){
                return 1;
            }else {
                return 2;
            }
        }
        return 0;
    }
    public void scoreChange(int result, Person person, Computer computer){
        if (result == 1){
            a++;
            computer.setScore(a);
        }else if (result == 2){
            b++;
            person.setScore(b);
        }else {
            a += 0;
            b += 0;
        }
    }
}
